package org.sgx.dao.test.test1;

import java.util.Date;

import org.sgx.dao.BeanDao;
import org.sgx.dao.Dao;
import org.sgx.dao.DaoException;
import org.sgx.dao.test.test1.testModel.BeanTest1;

import junit.framework.TestCase;

public class DaoTest2 extends TestCase {
	public void test1() throws DaoException {
		Dao<BeanTest1> dao1 = new BeanDao<BeanTest1>(DaoTest1.getValidConnectionGiver(), BeanTest1.class);
		
		//first we drop the table and then recreate the table in database for having a clean table to work with
		dao1.dropTable(); 
		dao1.createTable();
		
		Date date1 = new Date();
		BeanTest1 bean1 = new BeanTest1("hello", 888l, true, date1);	
		
		//add
		long newId = dao1.add(bean1);
		BeanTest1 bean1_ = dao1.get(newId);
		
	}
}
